package org.tigris.subversion.svnant.commands;

import java.io.BufferedOutputStream;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.apache.tools.ant.Project;
import org.tigris.subversion.svnant.SvnAntUtilities;
import org.tigris.subversion.svnclientadapter.ISVNClientAdapter;
import org.tigris.subversion.svnclientadapter.ISVNLogMessage;
import org.tigris.subversion.svnclientadapter.ISVNLogMessageChangePath;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNRevision;
import org.tigris.subversion.svnclientadapter.SVNRevision.Number;
import org.tigris.subversion.svnclientadapter.SVNUrl;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.Text;

public class Log extends SvnCommand
{
  private static final String MSG_FAILED_TO_LOAD = "Can't get the content of the specified file";
  private static final String MSG_CANT_GET_LOG_MESSAGES = "Can't get the log messages for the path or url";
  private File destFile = null;
  private SVNUrl url = null;
  private File path = null;
  private boolean stopOnCopy = true;
  private boolean asXml = true;
  private long limit = 0L;
  private SVNRevision startRevision = SVNRevision.HEAD;
  private SVNRevision stopRevision = new SVNRevision.Number(1L);
  private boolean changedpathes = false;

  public void execute()
  {
    if (this.destFile == null)
      this.destFile = new File(getProject().getBaseDir(), this.url.getLastPathSegment());
    ISVNLogMessage[] arrayOfISVNLogMessage = null;
    try
    {
      if (this.path != null)
        arrayOfISVNLogMessage = getClient().getLogMessages(this.path, this.startRevision, this.stopRevision, this.stopOnCopy, this.changedpathes, this.limit);
      else
        arrayOfISVNLogMessage = getClient().getLogMessages(this.url, this.startRevision, this.startRevision, this.stopRevision, this.stopOnCopy, this.changedpathes, this.limit);
      writeLogMessages(arrayOfISVNLogMessage);
    }
    catch (SVNClientException localSVNClientException)
    {
      throw ex(localSVNClientException, "Can't get the log messages for the path or url", new Object[0]);
    }
  }

  private void writeLogMessages(ISVNLogMessage[] paramArrayOfISVNLogMessage)
  {
    
  }

  protected void validateAttributes()
  {
    SvnAntUtilities.attrsNotSet("url, path", new Object[] { this.url, this.path });
    SvnAntUtilities.attrNotNull("startRevision", this.startRevision);
    SvnAntUtilities.attrNotNull("stopRevision", this.stopRevision);
  }

  public void setUrl(SVNUrl paramSVNUrl)
  {
    this.url = paramSVNUrl;
  }

  public void setPath(File paramFile)
  {
    this.path = paramFile;
  }

  public void setDestFile(File paramFile)
  {
    this.destFile = paramFile;
  }

  public void setStartRevision(String paramString)
  {
    this.startRevision = getRevisionFrom(paramString);
  }

  public void setStopRevision(String paramString)
  {
    this.stopRevision = getRevisionFrom(paramString);
  }

  public void setStopOnCopy(boolean paramBoolean)
  {
    this.stopOnCopy = paramBoolean;
  }

  public void setAsXml(boolean paramBoolean)
  {
    this.asXml = paramBoolean;
  }

  public void setLimit(int paramInt)
  {
    this.limit = paramInt;
  }

  public void setChangedpathes(boolean paramBoolean)
  {
    this.changedpathes = paramBoolean;
  }

  private void writeLogEntryAsPlaintext(ISVNLogMessage paramISVNLogMessage, BufferedWriter paramBufferedWriter)
    throws IOException
  {
    paramBufferedWriter.write("------------------------------------------------------------------------");
    paramBufferedWriter.newLine();
    paramBufferedWriter.write(114);
    paramBufferedWriter.write(paramISVNLogMessage.getRevision().toString());
    paramBufferedWriter.write(" | ");
    paramBufferedWriter.write(paramISVNLogMessage.getAuthor());
    paramBufferedWriter.write(" | ");
    paramBufferedWriter.write(paramISVNLogMessage.getDate().toString());
    if (this.changedpathes)
    {
      paramBufferedWriter.write("Changed paths:");
      paramBufferedWriter.newLine();
      for (ISVNLogMessageChangePath localISVNLogMessageChangePath : paramISVNLogMessage.getChangedPaths())
      {
        paramBufferedWriter.write("   " + localISVNLogMessageChangePath.getAction() + " ");
        paramBufferedWriter.write(localISVNLogMessageChangePath.getPath());
        paramBufferedWriter.newLine();
      }
    }
    paramBufferedWriter.newLine();
    paramBufferedWriter.newLine();
    paramBufferedWriter.write(paramISVNLogMessage.getMessage());
    paramBufferedWriter.newLine();
  }

  private void writeLogEntryAsXml(ISVNLogMessage paramISVNLogMessage, Document paramDocument, Element paramElement)
  {}
}

/* Location:           C:\Users\Administrator\Desktop\svnant.jar
 * Qualified Name:     org.tigris.subversion.svnant.commands.Log
 * JD-Core Version:    0.6.0
 */